//
//  MQSmallDetailFind.m
//  MinDyNews
//
//  Created by ZMQ on 16/7/21.
//  Copyright © 2016年 MQ. All rights reserved.
//

#import "MQSmallDetailFind.h"
#import "MQSmallDetailViewsOfFind.h"
#import "MQSamllModelOfFind.h"
#import "HTY360PlayerVC.h"


@interface MQSmallDetailFind ()

@property (nonatomic, retain) UIButton *buttonOfFanHui;//返回
@property (nonatomic, retain) UIButton *buttonOfPlay;//播放
@property (nonatomic, retain) MQSmallDetailViewsOfFind *viewOfDetailSmall;//加载

@end

@implementation MQSmallDetailFind


- (void)viewDidLoad {
    [super viewDidLoad];
    [self configNavigation];
    
    self.viewOfDetailSmall.modelOfSamll = _model;
   
}

-(void)configNavigation{
    
    
    self.viewOfDetailSmall = [[MQSmallDetailViewsOfFind alloc]initWithFrame:[UIScreen mainScreen].bounds];
    [self.view addSubview:_viewOfDetailSmall];

    
    
    self.buttonOfFanHui = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.viewOfDetailSmall addSubview:_buttonOfFanHui];
    [self.buttonOfFanHui setTitle:@"上一页"  forState: UIControlStateNormal];
    [self.buttonOfFanHui addTarget:self action:@selector(ClickFanHui) forControlEvents: UIControlEventTouchUpInside];
    self.buttonOfFanHui.tintColor = [UIColor blackColor];
    self.buttonOfFanHui.titleLabel.font = [UIFont systemFontOfSize:8 weight:2];
    self.buttonOfFanHui.backgroundColor = [UIColor colorWithRed:240 / 256.0  green:240 / 256.0  blue:240 / 256.0  alpha:0.6];
    self.buttonOfFanHui.layer.cornerRadius = 15;
    self.buttonOfFanHui.layer.masksToBounds = YES;
    [self.buttonOfFanHui mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewOfDetailSmall).with.offset(40);
        make.left.equalTo(self.viewOfDetailSmall).with.offset(20);
        make.width.offset(30);
        make.height.offset(30);
        
    }];

    
    /**播放*/
    
    self.buttonOfPlay = [ UIButton buttonWithType:UIButtonTypeCustom];
    [self.viewOfDetailSmall.imageViewOfcover addSubview:_buttonOfPlay];
    self.buttonOfPlay.layer.cornerRadius = 25;
    self.buttonOfPlay.layer.masksToBounds = YES;
    [self.buttonOfPlay mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.viewOfDetailSmall.imageViewOfcover);
        make.centerY.equalTo(self.viewOfDetailSmall.imageViewOfcover);
        make.width.offset(50);
        make.height.offset(50);
        
    }];
    
    [self.buttonOfPlay setImage:[UIImage imageNamed:@"multimedia-3"] forState:UIControlStateNormal];
    
    [self.buttonOfPlay addTarget:self action:@selector(PlayView:) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void) PlayView:(UIButton *) button {
    
    NSDictionary *dic = self.model.data;
    
    NSString *playURL = [dic objectForKey:@"playUrl"];
    
    NSURL *url = [NSURL URLWithString:playURL];
    
    HTY360PlayerVC *videoController = [[HTY360PlayerVC alloc] initWithNibName:@"HTY360PlayerVC"
                                                                       bundle:nil
                                                                          url:url];
    
    [self presentViewController:videoController animated:YES completion:nil];
    
}


-(void)ClickFanHui{
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
}


    







@end
